<?php

class framework {
	
	private $JSinclude = array();
	private $frameworkPath;

	private function framework_find($type,$framework,$file=null)
	{
		if ($file == null)
		{
			require('Library/Library.index');
		} else {
			require($file);
		}

		if ($type == 'PHP')
		{
			$this->frameworkPath = $PHP[$framework];
		} elseif ($type == 'JS') {
			$this->frameworkPath = $JS[$framework];
		} else {
			$this->frameworkPath == 'Library/null';
		}
		return $this->frameworkPath;
	}

	public function include_framework($type,$framework,$file=null)
	{
		$this->framework_find($type,$framework,$file);
		if($type == 'JS')
		{
			$this->JSinclude[] = $this->frameworkPath;
		} elseif ($type == 'PHP') {
			include($this->frameworkPath);
		} else {
			include('Library/null');
		}
	}

	function include_framework_once($type,$framework,$file=null)
	{
		$this->framework_find($type,$framework,$file);
		if($type == 'JS')
		{
			$this->JSinclude[] = $this->frameworkPath;
		} elseif ($type == 'PHP') {
			include_once($this->frameworkPath);
		} else {
			include('Library/null');
		}
	}

	function require_framework($type,$framework,$file=null)
	{
		$this->framework_find($type,$framework,$file);
		if($type == 'JS')
		{
			$this->JSinclude[] = $this->frameworkPath;
		} elseif ($type == 'PHP') {
			require($this->frameworkPath);
		} else {
			include('Library/null');
		}
	}

	function require_framework_once($type,$framework,$file=null)
	{
		$this->framework_find($type,$framework,$file);
		if($type == 'JS')
		{
			$this->JSinclude[] = $this->frameworkPath;
		} elseif ($type == 'PHP') {
			require_once($this->frameworkPath);
		} else {
			include('Library/null');
		}
	}

	public function JSpassString() // May be removed | for as internal API for theme lib
	{
		return $JSinclude;
	}

	public function debugJS()
	{
		echo "Debug Data:<br />\n";
		foreach($this->JSinclude as $key => $value)
		{
			echo "KEY: {$key}   VALUE: {$value}<br />\n";
		}
	}
}

$framework = new framework();

?>
